<%--
  Created by IntelliJ IDEA.
  User: 20426
  Date: 2020/7/23
  Time: 19:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>影院票务管理系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/back/layuiadmin/layui/css/layui.css" media="all">
</head>
<body>
<div class="layui-card">
    <div class="layui-card-header" id="ordersId"></div>
    <div class="layui-card-body">
        <p>电影名：<span id="filmName"></span></p>
        <p>影厅：<span id="auditoriumsName"></span></p>
        <p>开始时间：<span id="screeningStartTime"></span></p>
        <table class="layui-table">
            <colgroup>
                <col width="150">
                <col width="200">
            </colgroup>
            <h5>座位</h5>
            <thead>
            <tr>
                <th>排</th>
                <th>列</th>
            </tr>
            </thead>
            <tbody id="seat">
            </tbody>
        </table>
        <p>用户账号：<span id="accountName"></span></p>
        <p>支付方式：<span id="payType"></span></p>
        <p>支付金额：<span id="payPrice"></span></p>
    </div>
</div>

<script src="${pageContext.request.contextPath}/back/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '${pageContext.request.contextPath}/back/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['form'], function(){
        var $ = layui.$;
        $.ajax({
            url:"${pageContext.request.contextPath}/front/orders/${param.ordersId}"
            ,success:function(result){

                var html = ""
                $.each(result.ordersDetails,function(i,val){
                    console.log(val);
                    html +="<tr><td>"+val.seatLine+"</td><td>"
                        +val.seatColumn+"</td></tr>"
                });
                var ordersStatus = "";
                if(result.ordersStatus == 0){
                    ordersStatus = "未支付";
                }else if(result.ordersStatus == 1){
                    ordersStatus = "已支付";
                }else if(result.ordersStatus == 2){
                    ordersStatus = "已完成";
                }else if(result.ordersStatus == 3){
                    ordersStatus = "已退款";
                }else if(result.ordersStatus == 4){
                    ordersStatus = "已超时";
                }
                $("#ordersId").html("<h3>订单号:"+result.ordersId+"          "+ordersStatus+"</h3>");
                $("#seat").append(html);
                $("#auditoriumsName").text(result.screening.auditoriums.auditoriumsName);
                $("#filmName").text(result.screening.film.filmName);
                $("#accountName").html(result.account.accountName);
                $("#payType").text(result.payType);
                $("#payPrice").text(result.payPrice+"￥");
                $("#screeningStartTime").text(result.screening.screeningStartTime);
            },
            error:function(){}
        });
    });
</script>
</body>
</html>
